package vivek.project.pocketmoney.mutualfund.scripts
{
	import vivek.project.pocketmoney.admin.model.AdminDataCache;

	public class MutualFundScripts
	{
		public static const ADD_HISTORICAL_NAV:String="insert or ignore into MUTUALFUNDNAVHISTORY (MFN_SCHEMEID, MFN_date,mfn_nav) values (:mfn_schemeid,:mfn_date,:mfn_nav)";
		public static const DELETE_FUND_RECURSSIONS:String="delete from mutualfundrecurssion where mr_id=:mr_id";
		public static const DELETE_HISTORICAL_NAV:String="DELETE FROM MUTUALFUNDNAVHISTORY WHERE MFN_SCHEMEID=:mfn_schemeid and MFN_date=:mfn_date";
		public static const GET_LATEST_NAV_VALUE_FOR_SCHEME:String="SELECT max(mfn_date),mfn_nav,mfn_schemeid  FROM mutualfundnavhistory group by mfn_schemeid";
		public static const GET_NAV_VALUE_FOR_DATE:String="select mfn_schemeid,mfn_nav,mfn_date,sm_schemename from mutualfundnavhistory,schememanager where mfn_schemeid = :mfn_schemeid and mfn_date = :mfn_date";
		public static const MUTUALFUND_SCHEME_NAV_FOR_DATE:String="SELECT * FROM mutualfundnavhistory where  mfn_schemeid=:mfn_schemeid and mfn_date=:mfn_date"
		public static const MUTUAL_FUND_ADD_FUND:String="insert into MUTUALFUNDMANAGER (mm_fundname) values ( :mm_fundname)";
		public static const MUTUAL_FUND_ADD_RECURSSION:String="INSERT INTO MUTUALFUNDRECURSSION   ( mr_status, mr_startdate, mr_enddate, mr_date , mr_schemeid , mr_channel , mr_account , mr_amount,mr_nextexecution,mr_txntype,mr_userid) " + "VALUES (:mr_status, :mr_startdate, :mr_enddate, :mr_date , :mr_schemeid , :mr_channel , :mr_account , round(:mr_amount,2), :mr_nextexecution,:mr_txntype," + ":USERID" + ")";
		public static const MUTUAL_FUND_ADD_SCHEME:String="insert into SCHEMEMANAGER " + "(sm_navdate,sm_navvalue,sm_fundid,sm_schemename,sm_schemeid,sm_schemetype,sm_investtype,sm_exitloaddays,sm_entryLoadPercent,sm_exitLoadPercent) values" + " ( :sm_navdate,:sm_navvalue,:sm_fundid,:sm_schemename,:sm_schemeid,:sm_schemetype,:sm_investtype,:sm_exitLoadDays,:sm_entryLoadPercent,:sm_exitLoadPercent)";
		public static const MUTUAL_FUND_ADD_TRANSACTION:String="INSERT INTO MUTUALFUNDTRANSACTION (mt_date , mt_schemeid , mt_nav  , mt_unit , " + " mt_txntype , MT_ID  ,	mt_account , mt_channel ,	mt_memo,mt_folio,my_amountinvested,mt_userid ) " + "VALUES (:mt_date,:mt_schemeid,:mt_nav,round(:mt_unit,4),:mt_txntype,:mt_id," + ":mt_account ,:mt_channel ,:mt_memo,:mt_folio,:my_amountinvested," + ":USERID" + ");";
		public static const MUTUAL_FUND_CONTROL:String="SELECT * FROM MUTUALFUNDMANAGER order by mm_fundname";
		public static const MUTUAL_FUND_DELETE_SCHEME:String="delete from schememanager where sm_id=:id";
		public static const MUTUAL_FUND_DELETE_TRANSACTION:String="delete FROM MUTUALFUNDTRANSACTION WHERE :mt_id=mt_id";
		public static const MUTUAL_FUND_NAV_HISTORY:String="select mfn_schemeid,mfn_nav,mfn_date,sm_schemename from mutualfundnavhistory,schememanager where mfn_schemeid = sm_schemeid order by mfn_date asc";
		public static const MUTUAL_FUND_NAV_HISTORY_4_SCHEME:String="select mfn_schemeid,mfn_nav,mfn_date  from mutualfundnavhistory where mfn_schemeid = :mfn_schemeid order by mfn_date asc";
		public static const MUTUAL_FUND_RECURSSIONS:String="SELECT * FROM mutualfundrecurssion where  mr_userid  in (select userid from selecteduser)";
		public static const MUTUAL_FUND_RECURSSIONS_ALL:String="SELECT * FROM mutualfundrecurssion";
		public static const MUTUAL_FUND_SCHEME_ALL:String="select * from schememanager";
		public static const MUTUAL_FUND_SCHEME_UPDATE:String="update schememanager set sm_schemeid=:sm_schemeid,sm_schemename=:sm_schemename,sm_schemetype=:sm_schemetype,sm_investtype=:sm_investtype,sm_fundid=:sm_fundid,sm_schemename=:sm_schemename,sm_entryLoadPercent=:sm_entryLoadPercent,sm_exitLoadPercent=:sm_exitLoadPercent,sm_exitLoadDays=:sm_exitLoadDays where sm_id=:sm_id";
		public static const MUTUAL_FUND_TRANSACTIONS_4_SCHEME:String="select *  from mutualfundtransaction where mt_schemeid = :mt_schemeid order by mt_date asc";
		public static const MUTUAL_FUND_TRANSACTION_ALL:String="SELECT *,(mt_unit * mt_nav) mt_amount FROM MUTUALFUNDTRANSACTION,schememanager,accountmanager where mt_schemeid = sm_schemeid and mt_account=am_accountid and mt_userid  in (select userid from selecteduser) order by MT_DATE";
		public static const MUTUAL_FUND_TRANSACTION_BUY:String="SELECT * FROM MUTUALFUNDTRANSACTION,schememanager where mt_schemeid = sm_schemeid and mt_txntype= 0  and mt_userid in (select userid from selecteduser) order by MT_channel,mt_schemeid,mt_DATE DESC";
		public static const MUTUAL_FUND_TRANSACTION_SCHEME_UPDATE:String="update mutualfundtransaction set mt_schemeid=:mt_schemeid where :mt_schemeid=mt_schemeid";
		public static const MUTUAL_FUND_TRANSACTION_SELL:String="SELECT * FROM MUTUALFUNDTRANSACTION,schememanager where mt_schemeid = sm_schemeid and mt_txntype= 1  and mt_userid in (select userid from selecteduser) order by MT_channel,mt_schemeid,mt_DATE DESC";
		public static const MUTUAL_FUND_UPDATE_FUND:String="update mutualfundmanager set mm_fundname=:mm_fundname where mm_id=:mm_id";
		public static const MUTUAL_FUND_UPDATE_RECURSSION:String="Update MUTUALFUNDRECURSSION set mr_status=:mr_status,mr_startdate=:mr_startdate, mr_enddate=:mr_enddate, mr_date=:mr_date  , mr_schemeid =:mr_schemeid ,mr_channel=:mr_channel  ,mr_account= :mr_account ,mr_amount=round(:mr_amount), mr_nextexecution=:mr_nextexecution ,mr_txntype=:mr_txntype where mr_id=:mr_id";
		public static const UPDATE_MF_CAPDATA:String="update schememanager set sm_giantcap=:sm_giantcap, sm_largecap=:sm_largecap, sm_midcap=:sm_midcap, sm_midcap=:sm_midcap, sm_smallcap=:sm_smallcap, sm_tinycap=:sm_tinycap where :sm_schemeid=sm_schemeid";
		public static const UPDATE_MF_NAV:String="update schememanager set sm_navvalue=:sm_navvalue, sm_navdate=:sm_navdate where :sm_schemeid=sm_schemeid";
		public function MutualFundScripts()
		{
		}
	}
}